<style>
    table { border-collapse: collapse; }
    thead { border-bottom: 2px #8ab solid; border-top: 0px #8ab solid; } 
    tfoot { border-bottom: 1px solid #bde; border-top: 1px solid #bde; }
    th { color: #245; }
    .label { color: #689; }
    thead th {font-weight: bold;}
    th, td { padding: .5em .8em; height: 20px; } 
    a.record { text-decoration: none; }
</style>

<?php if(isset($this->head)) : ?>
<table cellspacing="0">
    <thead>
        <tr>
        <?php foreach($this->head['headers'] as $header) : ?>
            <th><?php echo $header[2] ?></th>
        <?php endforeach ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach($this->body as $row) : ?>
        <tr>
            <?php foreach($this->head['headers'] as $header) : ?>
                <td width="<?php echo $header[1] ?>px">
                    <?php if(isset($header[3])&&($header[3] == 'Number')&&
                            isset($header[4])&&($header[4] == 'Standard')) : ?>
                        <?php $row[$header[0]] = number_format($row[$header[0]],2,'.',','); ?>
                    <?php endif ?>
                    <?php echo $row[$header[0]] ?>
                </td>  
            <?php endforeach ?>
            <td>
                <?php if(isset($this->rlnk)): ?>
                    <?php $params = $this->rlnk['params']; ?>
                    <?php array_walk($params, function (&$val,$par,$row) {$val = $row[$val];}, $row) ?>
                    <?php echo $this->link($this->rlnk['base'],$params,$this->rlnk['text']) ?> 
                <?php endif; ?>
            </td>
        </tr>
        <?php endforeach ?>
    </tbody>
    <tfoot>
        <tr>
        <?php foreach($this->foot as $footer) : ?>
            <th><?php echo $footer ?></th>
        <?php endforeach ?>
        </tr>
    </tfoot>
</table>
<?php endif ?>